package tr.edu.metu.is.mega.server.timer;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

import tr.edu.metu.is.mega.server.business.MailService;
import tr.edu.metu.is.mega.server.dao.ReviewerDAO;
import tr.edu.metu.is.mega.server.entity.Reviewer;

/**
 * Sends notification e-mail to students for activities needs to be alerted,
 * non-submitted activity notifiers for reviewers.
 */
public class ReviewerNotifier {

    public static void doJob() {
        System.out.println("ReviewerNotifier.doJob() " + new Date());

        ReviewerDAO dao = new ReviewerDAO();
        List<Reviewer> findByNamedNativeQuery = dao.findByNamedNativeQuery("Reviewer.listSubmissions", new HashMap<Integer, Object>());
        for (Reviewer reviewer : findByNamedNativeQuery) {
            MailService.reviewMailer(reviewer);
        }
    }
}
